package model

import (
	"newRetailByGolang/variable"
	"time"
)

type OrderGood struct {
	Id        int64
	OrderId   int64
	GoodId    int64
	CreatedAt time.Time
	UpdatedAt time.Time
}

func (og *OrderGood) Insert(g *OrderGood) {
	variable.Db.Create(g)
}

func (og *OrderGood) BatchInsert(gs []*OrderGood) {
	variable.Db.Create(&gs)
}

func (og *OrderGood) Delete(id int64) {
	variable.Db.Delete(og, id)
}

func (og *OrderGood) Update(g *OrderGood) {
	variable.Db.Save(g)
}

func (og *OrderGood) BatchDelete(relation string, id int64) {
	variable.Db.Where(relation+" = ?", id).Delete(og)
}



